#include "head.h"

int create_thread(resource_p *rsbp, int num){
    //初始化参数
    bzero(&rsbp->queue, sizeof(queue_t));

    pthread_mutex_init(&rsbp->lock, NULL);
    pthread_cond_init(&rsbp->cond, NULL);

   //创建线程
   rsbp->list = (pthread_t*)calloc(num, sizeof(pthread_t));

   for(int i = 0; i < num; i++){
     int ret1 =  pthread_create(&rsbp->list[i], NULL, thread_main, rsbp);
     ERROR_CHECK(ret1, -1, "create_thread_error");
   }
   return 0;
}


